﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.ServiceProcess;
using ITXTTF;
namespace IntexPrinting
{
    public partial class SVCITXTTF : ServiceBase
    {
        ITXPrint itxprint = new ITXPrint();
        public string sznop1 = "nop_front\r\n";
        public string sznop2 = "nop_middle\r\n";
        Dictionary<string, string> env = new Dictionary<string, string>();
        List<string> watchpath = new List<string>();
        string printofile = "file";
        public SVCITXTTF()
        {
            InitializeComponent();
            ReadConfig();
            Watcher watcher = new Watcher(watchpath, printofile);    
        }

        protected override void OnStart(string[] args)
        {
            
        }
        private void ReadConfig()
        {
            string strKey = "";

            try
            {
                foreach (string key in System.Configuration.ConfigurationSettings.AppSettings)
                {
                    strKey = key.ToString();
                    if (strKey.StartsWith("wpath"))
                    {
                        watchpath.Add(ConfigurationSettings.AppSettings[strKey].ToString());
                    }
                    if (strKey.StartsWith("printofile"))
                    {
                        printofile = ConfigurationSettings.AppSettings[strKey].ToString();
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }

        protected override void OnStop()
        {
        }
    }
}
